//
// Created by 28735 on 2024/11/22.
//

#ifndef SEQLIST_H
#define SEQLIST_H

#include <cstdlib>

/*  c implement*/
typedef struct SeqList_ptr_c
{
    int* data;
    int length;
    int location;
}* SeqList_c;

inline void initialize(SeqList_c& seqList_c, const int length)
{
    /*  malloc method must input a parameter of size, which is calculated by ourselves*/
    seqList_c->data = (int*)malloc(length * sizeof(int));

    /*  new method pointer with allot size automatic*/
    seqList_c->data = new int[length];

    seqList_c->length = length;

    seqList_c->location = 0;
}

inline void add(const SeqList_c& seqList_c, const int val)
{
    if (seqList_c->location < seqList_c->length)
    {
        seqList_c->data[seqList_c->location++] = val;
    }
}

/*  c++ implement*/
class Adjacent_matrix
{
public:
    int* data;
    int length;
    int location;

public:
    explicit Adjacent_matrix(const int length): data(new int [length]), length(length), location(0){};

    ~Adjacent_matrix() = default;


};

#endif //SEQLIST_H
